package com.aaa.mapper;

import com.aaa.entity.Permission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface PermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Permission record);

    int insertSelective(Permission record);

    Permission selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Permission record);

    int updateByPrimaryKey(Permission record);

    /**
     * 根据用户查询该用户具有的菜单
     * @param userid
     * @return
     */
    List<Permission> selectByUserId(Integer userid);

    /**
     * 查询所有权限
     * @return
     */
    List<Permission> selectAll();

    /**
     * 根据角色查询该角色具有的权限id
     * @param roleId
     * @return
     */
    List<Integer> selectByRoleId(int roleId);


    void deleteByRoleId(Integer roleId);

    void batchPermission(@Param("roleId") Integer roleId,@Param("permissionIds") Integer[] permissionIds);
}








